home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / TeX-inputs / LaTeX / tools / showkeys.sty (.txt) < prev    next >
LaTeX Document  |  1997-03-07  |  7KB  |  201 lines

  1. %% This is file `showkeys.sty',
  2. %% generated with the docstrip utility.
  3. %% The original source files were:
  4. %% showkeys.dtx  (with options: `package')
  5. %% IMPORTANT NOTICE:
  6. %% This file is a generated file from the sources of the `tools' bundle
  7. %% in the LaTeX2e distribution.
  8. %% For the copyright notice see the source file(s).
  9. %% You are not allowed to modify this file.
  10. %% You are allowed to distribute this file if and only if
  11. %% it is distributed with the corresponding source files in
  12. %% the `tools' bundle.
  13. %% For the copying and distribution conditions of the source files,
  14. %% see the file readme.txt distributed with the tools bundle.
  15. %% File: showkeys.dtx Copyright (C) 1992-1996 David Carlisle
  16. \NeedsTeXFormat{LaTeX2e}
  17. \ProvidesPackage{showkeys}
  18.           [1996/11/01 v3.11 Show cite and label keys (DPC)]
  19. \DeclareOption{notref}{\let\SK@ref\@empty}
  20. \DeclareOption{notcite}{\let\SK@cite\@empty}
  21. \let\SK@refcolor\relax
  22. \let\SK@labelcolor\relax
  23. \DeclareOption{color}{\AtEndOfPackage{%
  24.   \RequirePackage{color}%
  25.   \definecolor{refkey}{gray}{.75}%
  26.   \definecolor{labelkey}{gray}{.75}%
  27.   \def\SK@refcolor{\color{refkey}}%
  28.   \def\SK@labelcolor{\color{labelkey}}}}
  29. \DeclareOption{final}{\endinput}
  30. \DeclareOption{draft}{}
  31. \ProcessOptions
  32. \let\SK@label\label
  33. \let\SK@bibitem\@bibitem
  34. \let\SK@lbibitem\@lbibitem
  35. \def\label#1{%
  36.   \@bsphack
  37.   \SK@\SK@@label{#1}%
  38.   \begingroup
  39.     \SK@label{#1}%
  40.   \endgroup
  41.   \@esphack}
  42. \def\@bibitem#1{%
  43.   \SK@bibitem{#1}\SK@\SK@@label{#1}\ignorespaces}
  44. \def\@lbibitem[#1]#2{%
  45.   \SK@lbibitem[#1]{#2}\SK@\SK@@label{#2}\ignorespaces}
  46. \def\SK@#1#2{%
  47.   \protected@edef\@tempa{#2}%
  48.   \expandafter#1\meaning\@tempa\SK@}
  49. \def\SK@@label#1>#2\SK@{%
  50.   \gdef\SK@lab{\smash{\SK@labelcolor\fbox{%
  51.                      \normalfont\small\ttfamily#2}}}%
  52.   \ifvmode
  53.     \if@inlabel
  54.       \global\setbox\@labels\hbox{%
  55.         \llap{\SK@lab\SK@lab@relax
  56.               \kern\@totalleftmargin\kern\marginparsep}%
  57.         \box\@labels}%
  58.     \else
  59.       \dimen@\prevdepth
  60.       \nointerlineskip
  61.       \ifinner
  62.         \skip@\lastskip\unskip
  63.         \advance\skip@\lastskip\unskip
  64.         \setbox\z@\lastbox
  65.         \ifvoid\z@
  66.           \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
  67.         \else
  68.           \hbox{\box\z@\kern\marginparsep\SK@labx}%
  69.         \fi
  70.         \vskip\skip@
  71.       \else
  72.         \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
  73.       \fi
  74.       \prevdepth\dimen@
  75.     \fi
  76.   \else
  77.     \csname SK@\@currenvir\endcsname
  78.     \ifSK@equation\else
  79.       \ifmmode
  80.         \SK@labx
  81.       \else
  82.         \ifinner
  83.           \rlap\SK@lab
  84.       \else
  85.           \vadjust{\llap{\SK@lab\kern\marginparsep}}%
  86.         \fi
  87.         \SK@lab@relax
  88.       \fi
  89.     \fi
  90.   \fi}
  91. \AtBeginDocument{%
  92.   \let\SK@eqnnum\@eqnnum
  93.   \def\@tempa{\let\iftagsleft@\iffalse}%
  94.   \ifx\iftagsleft@\undefined\@tempa\fi%
  95.   \let\SK@tagform@\tagform@
  96.   \iftagsleft@
  97.     \def\tagform@#1{%
  98.       \ifx\df@label\@empty
  99.         \SK@lab@relax
  100.       \else
  101.         \expandafter\SK@@label\meaning\df@label\SK@
  102.       \fi
  103.       \llap{\SK@lab\kern\marginparsep}%
  104.       \SK@lab@relax\SK@tagform@{#1}}%
  105.     \def\@eqnnum{%
  106.       \llap{\SK@lab\kern\displaywidth\kern\marginparsep}%
  107.       \SK@lab@relax\SK@eqnnum}%
  108.   \else
  109.     \def\tagform@#1{%
  110.       \ifx\df@label\@empty
  111.         \SK@lab@relax
  112.       \else
  113.         \expandafter\SK@@label\meaning\df@label\SK@
  114.       \fi
  115.       \SK@tagform@{#1}%
  116.       \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}%
  117.     \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}%
  118.                      \SK@lab@relax}%
  119.   \fi}
  120. \def\SK@labx{\rlap\SK@lab\global\let\SK@lab\relax}
  121. \def\SK@lab@relax{\global\let\SK@lab\relax}\SK@lab@relax
  122. \newif\ifSK@equation
  123. \let\SK@equation\SK@equationtrue
  124. \let\SK@eqnarray\SK@equationtrue
  125. \toks@\expandafter{\eqnarray}
  126. \edef\eqnarray{\let\noexpand\tagform@\noexpand\SK@tagform@\the\toks@}
  127. \let\SK@align\SK@equationtrue
  128. \let\SK@alignat\SK@equationtrue
  129. \let\SK@xalignat\SK@equationtrue
  130. \let\SK@xxalignat\SK@equationtrue
  131. \let\SK@gather\SK@equationtrue
  132. \let\SK@multline\SK@equationtrue
  133. \let\SK@flalign\SK@equationtrue
  134. \def\SK@def#1{%
  135.   \edef\@tempa{\expandafter\@gobble\string#1}%
  136.   \@ifundefined{\@tempa\space}%
  137.     {\expandafter\let\csname SK@\@tempa\endcsname#1}%
  138.     {\expandafter\let\csname SK@\@tempa\expandafter\endcsname
  139.                          \csname\@tempa\space\endcsname}%
  140.   \expandafter\def\expandafter#1\expandafter{%
  141.         \expandafter\protect\csname\@tempa\space\endcsname}%
  142.   \expandafter\def\csname\@tempa\space\endcsname}
  143. \ifx\SK@ref\@empty
  144. \AtBeginDocument{%
  145.   \ifx\vpageref\@undefined\else
  146.     \SK@def\@@vpageref#1[#2]#3{{%
  147.       \let\label\SK@label
  148.       \SK@@@vpageref#1[#2]{#3}}}%
  149.     \DeclareRobustCommand\vref[1]{%
  150.       \unskip~\ref{#1}%
  151.       {\let\label\SK@label
  152.        \SK@@@vpageref\unskip[\unskip\space]{#1}}}%
  153.   \fi}
  154. \else
  155. \AtBeginDocument{%
  156.   \SK@def\ref#1{\SK@\SK@@ref{#1}\SK@ref{#1}}%
  157.   \SK@def\pageref#1{\SK@\SK@@ref{#1}\SK@pageref{#1}}%
  158.   \ifx\vpageref\@undefined\else
  159.     \SK@def\@@vpageref#1[#2]#3{{%
  160.       \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
  161.       \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref#1[#2]{#3}}}%
  162.     \DeclareRobustCommand\vref[1]{%
  163.       \unskip~\ref{#1}%
  164.       {\let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
  165.        \SK@@@vpageref\unskip[\unskip\space]{#1}}}%
  166.   \fi}
  167. \ifx\SK@cite\@empty
  168. \AtBeginDocument{%
  169.   \ifx\HAR@checkdef\@undefined\else
  170.       \expandafter\let\expandafter
  171.          \SK@HAR@bi\csname\string\harvarditem\endcsname
  172.       \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
  173.         \SK@HAR@bi[#1]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
  174.   \fi}
  175. \else
  176. \AtBeginDocument{%
  177.   \ifx\HAR@checkdef\@undefined
  178.     \SK@def\cite#1#{\SK@citea{#1}}%
  179.     \SK@def\citeauthor#1{\SK@\SK@@ref{#1}\SK@citeauthor{#1}}%
  180.     \SK@def\citefullauthor#1{\SK@\SK@@ref{#1}\SK@citefullauthor{#1}}%
  181.     \SK@def\citeyear#1{\SK@\SK@@ref{#1}\SK@citeyear{#1}}%
  182.   \else
  183.     \SK@def\HAR@checkdef#1#2{%
  184.       \expandafter\SK@\expandafter\SK@@ref\expandafter{#1}%
  185.       \SK@HAR@checkdef{#1}{#2}}%
  186.       \expandafter\let\expandafter
  187.          \SK@HAR@bi\csname\string\harvarditem\endcsname
  188.       \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
  189.         \SK@HAR@bi[#1]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
  190.   \fi}
  191. \def\SK@citea#1#2{%
  192.   \SK@\SK@@ref{#2}\SK@cite#1{#2}}
  193. \def\SK@@ref#1>#2\SK@{%
  194.   \leavevmode\vbox to\z@{%
  195.     \vss
  196.     \SK@refcolor
  197.     \rlap{\vrule\raise .75em%
  198.        \hbox{\underbar{\normalfont\footnotesize\ttfamily#2}}}}}
  199. \endinput
  200. %% End of file `showkeys.sty'.
  201.